import request from "@/utils/request";
import type { BaseSaleAttrListType, SpuImageListType, SpuInfoType, SpuPageListType, SpuSaleAttrListType } from "@/types/spu";

// 获取SPU列表
export const reqSpuList = (page: number, limit: number, categoryId3: number) => {
    return request.get<null, SpuPageListType>(`/admin/product/${page}/${limit}?category3Id=${categoryId3}`);
};
// 添加SPU
export const reqAddSpu = (spuInfo: SpuInfoType) => {
    return request.post<null, null>("/admin/product/saveSpuInfo", spuInfo);
};
// 修改SPU
export const reqUpdateSpu = (spuInfo: SpuInfoType) => {
    return request.post("/admin/product/updateSpuInfo", spuInfo);
};
// 删除SPU
export const reqDeleteSpu = (spuId: number) => {
    return request.delete(`/admin/product/deleteSpu/${spuId}`);
};
// 获取所有销售属性列表
export const reqBaseSaleAttrList = () => {
    return request.get<null, BaseSaleAttrListType>("/admin/product/baseSaleAttrList");
};
// 获取SPU图片列表
export const reqSpuImageList = (spuId: number) => {
    return request.get<null, SpuImageListType>(`/admin/product/spuImageList/${spuId}`);
};
// 获取SPU销售属性列表
export const reqSpuSaleAttrList = (spuId: number) => {
    return request.get<null, SpuSaleAttrListType>(`/admin/product/spuSaleAttrList/${spuId}`);
};
